$(function(){
     $('#searchList').css("width",$("#searchParent").width())
    $('#selectOption').bind('change',function(){
        $("#searchLoad").val("");
        $('#searchList').css("display","none");
        var selectOption = $("#selectOption").val();
        if(selectOption == '地址'){
            searchLoad.onkeyup = function(){
                var inputLoad = this.value,
                    html='';
                    if(!inputLoad){
                        $('#searchList').css("display","none");
                        return;
                    }
        $.ajax({
            type:"POST",
            url:"/evaluate/searchAddress",
            data:{"fullName":inputLoad },
            dataType:"json",
            success:function(data){
               var result=data.result;
               if(result.length == 0) {
                   html += "<p>暂无数据</p>"
               }
               console.log(result)
                $.each(result,function(i,result){
                    html +="<p><a href ='/evaluate/searchCommunity?id="+result.addressId+"&areaId="+result.areaId+"'>"+result.fullName+"<a/></p>"
                });
                $('#searchList').html(html);
                $('#searchList').css("display","block");
            }
        })}
        }else if(selectOption == '房屋编号'){
            searchLoad.onkeyup = function(){
                var inputLoad = this.value,
                    html='';
                if(!inputLoad){
                    $('#searchList').css("display","none");
                    return;
                }
                $.ajax({
                    type:"POST",
                    url:"/evaluate/searchHouseSerialNumber",
                    data:{"houseSerialNumber":inputLoad },
                    dataType:"json",
                    success:function(data){
                        var result=data.result;
                        if(result.length==0){
                            html +="<p>暂无数据</p>"
                        }
                        $.each(result,function(i,result){
                            html +="<p><a href='/evaluate/searchHouse?communityId="+result.communityId+"&houseId="+result.houseId+"'>"+result.houseSerialNumber+"</a></p>"

                            //     <p>
                            //      <a href ='/evaluate/searchHouse?communityId=${result.communityId}&houseId=${result.houseId}'>${result.houseSerialNumber}<a/>
                            // <p/>;
                        });
                        $('#searchList').html(html);
                        $('#searchList').css("display","block");
                    }
            })}
        }
    });
    $('#selectOption').change();
})